//
//  PersonMenuView.m
//  KeHuaAlarm
//
//  Created by Fidetro on 2016/12/6.
//  Copyright © 2016年 DTSTON. All rights reserved.
//

#import "PersonMenuView.h"
#import "Masonry.h"
@interface PersonMenuView ()
/** 头像的背景圆 **/
@property(nonatomic,strong) UIView *headBgView;

/** 手机号码 **/
@property(nonatomic,strong) UILabel *phoneLabel;
@end

@implementation PersonMenuView

- (instancetype)init{
    
    if (self = [super init]) {
        
        [self masLayoutSubview];
        
    }
    
    return self;
    
}

- (void)masLayoutSubview{
    __weak UIView *superView = self;
    [superView addSubview:self.headBgView];
    [self.headBgView addSubview:self.headImageView];
    [self.headBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.centerY.mas_equalTo(superView.mas_centerY).mas_offset(20);
        make.height.mas_equalTo(80);
        make.width.mas_equalTo(80);
        
    }];
    [self.headImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(self.headImageView.superview.mas_centerY);
        make.centerX.mas_equalTo(self.headImageView.superview.mas_centerX);
        make.height.mas_equalTo(76);
        make.width.mas_equalTo(76);
        
    }];
    [self.nickNameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(self.headBgView.mas_bottom).mas_offset(5);
        make.centerX.mas_equalTo(superView.mas_centerX);
        
    }];
    [self.phoneLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(self.nickNameLabel.mas_bottom).mas_offset(5);
        make.centerX.mas_equalTo(superView.mas_centerX);
        
    }];
    
    [self.eventBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.mas_equalTo(self);
        
    }];

    
}

- (UIView *)headBgView{
    
    if (!_headBgView) {
        
        _headBgView = [[UIView alloc]init];
//        _headBgView.backgroundColor = [UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:1];
        _headBgView.layer.masksToBounds = YES;
        _headBgView.layer.cornerRadius = 40.f;
        _headBgView.layer.borderWidth = 1.f;
        _headBgView.layer.borderColor = [UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:1].CGColor;

        
    }
    
    return _headBgView;
    
}

- (UIButton *)eventBtn{
    
    if (!_eventBtn) {
        
        _eventBtn = [[UIButton alloc] init];
        [self addSubview:_eventBtn];
    }
    return _eventBtn;
}

- (UIImageView *)headImageView{
    
    if (!_headImageView) {

        _headImageView = [[UIImageView alloc]init];
        _headImageView.layer.masksToBounds = YES;
        _headImageView.layer.cornerRadius = 38.f;
        
        
    }
    
    return _headImageView;
    
}

- (UILabel *)nickNameLabel{
    
    if (!_nickNameLabel) {
        
        __weak UIView *superView = self;
        _nickNameLabel = [[UILabel alloc]init];
        [_nickNameLabel setFont:[UIFont systemFontOfSize:14.f]];
        [superView addSubview:_nickNameLabel];
        
        
    }
    
    return _nickNameLabel;
    
}

- (UILabel *)phoneLabel{
    
    if (!_phoneLabel) {
        
        __weak UIView *superView = self;
        _phoneLabel = [[UILabel alloc]init];
        [superView addSubview:_phoneLabel];
        [_phoneLabel setTextColor:[UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:1]];
        [_phoneLabel setFont:[UIFont systemFontOfSize:13.f]];
        
    }
    
    return _phoneLabel;
    
}


@end
